#ifndef __PVMVOICESOURCEOGGVORBIS_H__
#define __PVMVOICESOURCEOGGVORBIS_H__

#include "pvm/pvmapi.h"
#include "lib/pvmvoicesource.h"
#include "lib/decoders/oggvorbis/pvmvoiceoggvorbis.h"
#include "lib/decoders/oggvorbis/pvmovdatasource.h"
#include "lib/decoders/oggvorbis/pvmoggincludes.h"

#include "lib/memory/pvmmemory.h"

class PVMVoiceSourceOggVorbis : public IPVMVoiceSource, public PVMAllocableObject
{
protected:
	PVMVoiceSourceOggVorbis();
public:
	virtual ~PVMVoiceSourceOggVorbis();

	virtual IPVMVoice* CreateVoice(pvm_int samplesPerSecond, pvm_int bitsPerSample, pvm_int chanelsNum);
	virtual void Destroy();
	virtual pvm_int GetLengthMS();

	virtual pvm_bool GetOption(const pvm_char* optionName, void* optionVal, pvm_uint32* optionSize);
	virtual pvm_bool SetOption(const pvm_char* optionName, void* optionVal, pvm_uint32 optionSize);
public:
	static PVMVoiceSourceOggVorbis* Create(IPvmInStream* inStream);
protected:
	PVMOVDataSource*	dataSource;
	vorbis_info*		vInfo;
	PVMCriticalSection	critical;
};

#endif
